<?php 

require_once('getconfig.php');

Class Model_religion extends Dbo_DbManager
 {

	protected $C_RELIGION;
	protected $N_RELIGIONCOUNT;
	

 	public function __construct($bolCon=TRUE) {
		parent::__construct($bolCon);
	}
	
	public function getReligion()
	{
		return  $this->C_RELIGION;
	}
	
	public function getReligionCount()
	{
		return  $this->N_RELIGIONCOUNT;
	}		

	public function setReligion($C_RELIGION)
	{
		$this->C_RELIGION=$C_RELIGION;
	}
	
	public function setReligionCount($N_RELIGIONCOUNT)
	{
		$this->N_RELIGIONCOUNT=$N_RELIGIONCOUNT;
	}		

	public function write()
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->write($this,FALSE);
	}
	public static function delete($intproductid)
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->remove($intproductid,__CLASS__);
	}

	public static function build(array $arrModel_typeofbusiness)
	{
		$objModel_typeofbusiness = new Model_religion(FALSE);
		@$objModel_typeofbusiness->setReligion($arrModel_typeofbusiness['C_RELIGION']);
		@$objModel_typeofbusiness->setReligionCount($arrModel_typeofbusiness['N_RELIGIONCOUNT']);

		return $objModel_typeofbusiness;
 	 } 	 
    
     public static function get_Religion(){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select * from religion order by C_RELIGION ";
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}
	
     public static function get_Religioncount($typeofbusiness){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select N_RELIGIONCOUNT from religion where C_RELIGION='$typeofbusiness' ";
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}	

 }
 ?>